<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="q" uri="/query-tags"%>
<html>
	<head>
		<title>查询</title>
		
		<link href="${pageContext.request.contextPath}/core/css/mes.css" rel="stylesheet" type="text/css" />
		<link href="${pageContext.request.contextPath}/core/css/style.css" rel="stylesheet" type="text/css" />
		
		
		<script language="javascript" type="text/javascript" 
			src="${pageContext.request.contextPath}/core/js/jquery.js"></script>

		<script language="javascript" type="text/javascript" 
			src="${pageContext.request.contextPath}/core/js/jquery.form.js"></script>
	<!--		
		<script language="javascript" type="text/javascript" 
			src="${pageContext.request.contextPath}/core/js/global.cw.js"></script>
	  -->		
		<script type="text/javascript">
		
		
		$(function(){
	
			//如果是必填的，则加红星标识.
			$("form :input[TYPE=text]").each(function(){
				var $required = $("<strong class='high'> *</strong>"); //创建元素
				$(this).parent().append($required); //然后将它追加到文档中
			});

			//文本框失去焦点后
		    $('form :input').blur(function(){
				 var $parent = $(this).parent();
				 $parent.find(".formtips").remove();
				 //验证用户名
				 if( $(this).is('#itemNameCn') ){
						if( this.value=="" || this.value.length < 6 ){
						    var errorMsg = '请输入至少6位的cn.';
	                        $parent.append('<span class="formtips onError">'+errorMsg+'</span>');
						}else{
						    var okMsg = '输入正确.';
						    $parent.append('<span class="formtips onSuccess">'+okMsg+'</span>');
						}
				 }
				 //验证邮件
				 if( $(this).is('#itemNameEn') ){
					if( this.value=="" || ( this.value!="" && !/.+@.+\.[a-zA-Z]{2,4}$/.test(this.value) ) ){
	                      var errorMsg = '请输入正确的E-Mail地址.';
						  $parent.append('<span class="formtips onError">'+errorMsg+'</span>');
					}else{
	                      var okMsg = '输入正确.';
						  $parent.append('<span class="formtips onSuccess">'+okMsg+'</span>');
					}
				 }
			}).keyup(function(){$(this).triggerHandler("blur");}).focus(function(){$(this).triggerHandler("blur");});//end blur

			
			
			
			var options= {
					target:"#main"
			};	
			$("#findId").click(function(){
//				if($("itemNameCn".value == ""))
//				{
//				alert("XX不能为空");
//				}
		//		isEmpty("itemNameCn","ooooooooee");
				
				$("#findForm").ajaxSubmit(options);
			});
			$("#resetId").click(function(){
				$("#findForm").resetForm(options);
			});
		});
	
		</script>
	</head>
	<body>
		<div style="width: 800px" align="center">
			<fieldset style="width: 700px;">
				<legend>
					<label>国家·信息查询</label>
				</legend>
				<div>
					<form action="findByPage" id="findForm">
						<div>
							<label>通用中文名</label>
							<input type="text" name="qu.itemNameCn" id="itemNameCn"/>
						</div>
				
						<div>
							<label>通用英文名</label>
							<input type="text" name="qu.itemNameEn" id="itemNameEn"/>
						</div>
				
						<div>
							<input type="button" id="findId" value="查询"/>
							<input type="button" id="resetId" value="重置"/>
						</div>
					</form>
					
				</div>
			</fieldset>
		</div>
		
		<div id="mainDiv">
		   <s:action name="findByPage"  executeResult="true"></s:action> 
		</div>
		
	</body>
</html>


